<template>
  <PageDialog
    :title="dialogInfo.title"
    v-model:visible="shows"
    :width="dialogInfo.width"
    :bt-loading="dialogInfo.btLoading"
    :bt-list="dialogInfo.btList"
  >
    <div class="dialog-table">
      <NewPageFilter
        v-model:query="filterInfo.query"
        :filter-list="filterInfo.list"
      >
        <template v-slot:filter-button>
          <div class="dialog-table-header">
            <div class="header-left">
              <div class="lable">评价分类名称：{{ info.classifyName }}</div>
              <div class="lable">分值：{{ info.classifyScore }}</div>
            </div>
          </div>
        </template>
      </NewPageFilter>
    </div>

    <dialog-table
      :refresh="tableInfo.refresh"
      :init-curpage="tableInfo.initCurpage"
      v-model:data="tableInfo.data"
      :check-box="false"
      :pager="false"
      :tab-index="true"
      :handle="tableInfo.handle"
      :listen-height="false"
      :field-list="tableInfo.fieldList"
    >
    </dialog-table>
  </PageDialog>
</template>

<script setup name="IndividualDetails">
import PageDialog from '@/components/PageDialog/index'

import { getPutShelfTaskDetailCustomizeListAll } from '@/api/wms'
import DialogTable from '@/components/DialogTable/index'
const { proxy } = getCurrentInstance()
const emit = defineEmits()
const props = defineProps({
  api: {
    type: Function,
    default: getPutShelfTaskDetailCustomizeListAll,
  },
  showDialog: {
    type: Boolean,
  },
  query: {
    type: Object,
    default: function () {
      return {}
    },
  },
  info: {
    type: Object,
    default: function () {
      return {}
    },
  },
})

// 过滤相关配置
const filterInfo = reactive({
  keyword: '',
  query: {
    queryMap: {
      ...props.query,
    },
    queryParams: {},
    customizeUserVO: {},
  },
  list: [{ slot: true, value: 'button' }],
})
// 表格相关
const tableInfo = reactive({
  refresh: 1,
  initCurpage: 1,
  data: [],
  api: undefined,
  copyData: [],
  selections: [],
  fieldList: [
    { label: '评价项目名称', value: 'itemName' },
    { label: '分值', value: 'itemScore' },
  ],
})
// 弹窗相关
const dialogInfo = reactive({
  title: '个体详情',
  width: '90%',
  btLoading: false,
  btList: [{ label: '关闭', event: handleClose, show: true }],
})

const shows = computed({
  get() {
    return props.showDialog
  },
  set(newValue) {
    emit('update:showDialog', newValue) // 更新父组件shows
  },
})
getList()

// 获取列表
function getList() {
  tableInfo.data = props.info.itemDetails
}

// 关闭弹窗前的回调
function handleClose() {
  shows.value = false
  emit('reset')
}
</script>

<style scoped lang="scss">
:deep(.filter-item) {
  width: 100%;
}
.text-style {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.scan-groups {
  display: flex !important;
  align-items: center;
}
</style>
